﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Zhp.Common.Appsetting
{
    /// <summary>
    /// 缓存设置
    /// </summary>
    [AppSetting("Cache")]
    public class CacheOptions
    {
        /// <summary>
        /// 使用Redis
        /// </summary>
        public bool UseRedis { get; set; }

        /// <summary>
        /// Redis设置
        /// </summary>
        public RedisSettings RedisSettings { get; set; }
    }

    /// <summary>
    /// Redis设置
    /// </summary>
    public class RedisSettings
    {
        /// <summary>
        /// 连接地址
        /// </summary>
        public string Address { get; set; }

        /// <summary>
        /// 密码
        /// </summary>
        public string Password { get; set; }

        /// <summary>
        /// 数据库
        /// </summary>
        public int Db { get; set; } = 0;

        /// <summary>
        /// key前缀
        /// </summary>
        public string InstanceName { get; set; }

        /// <summary>
        /// 是否每次启动都清空
        /// </summary>
        public bool ClearRedis { get; set; } = false;
    }
}
